(function() {
	app.controller("indexCtrl", function($scope,$state) {
		$scope.$watch('indexCtrl',function(){
			$("title").text("悦农宝");
		})
		
		$scope.size = 10;
		$scope.currPage = 1;
		$scope.totalData = 1;
		$scope.obj = 1;
		$scope.arrList = [];
		$scope.imageHost=imageHost;
		$scope.footMarket=1;
		
		$scope.initFn = function() {
			var postData = {};
			postData.type = $scope.obj; //套餐类型
			postData.size = $scope.size; //一次显示多少
			postData.current = $scope.currPage; //当前页
			ticketpage(postData,$state,$scope);
		}
		$scope.initFn();
		
		/*导航条切换*/
		$scope.banner = function(obj,event) {
			$(".tab-link").css("color","#333")
			$(event.target).find("span").css("color","#21A3A3");
			$(event.target).css("color","#21A3A3");
			var val=$(event.target).html();
			$scope.currPage = 1;
			loading = false;
			$scope.obj = obj;
			$scope.initFn();
		}
		$scope.convert = function(id,name){
			var list = {};
			list.id = id;
			list.name = name;
			setUrl(list , "indexConvert" , "detail" , $state);
		}
		
		/*滚动加载*/
		loading = false;
		window.onscroll=function() {
		 	var postData = {};
			postData.type = $scope.obj; //套餐类型
			postData.size = $scope.size; //一次显示多少
			postData.current = $scope.currPage; //当前页
			var url = "api/ticket/page";
			windowScoll(postData,url,$state,$scope);
		}
		
		
	
	});
}());